<?php

class UserSetAction extends PublicAction
{
    //会员设置
    public function index()
    {
        $config_db = M('UserConfig');
        if (IS_POST) {

            $sta = false;
            foreach ($_POST as $key => $value) {
                $data['value'] = $value;
                $f = $config_db->where("varname='" . $key . "'")->save($data);
                if ($f) {
                    $sta = true;
                }
            }

            if ($sta) {
                $this->success('保存成功!');
            } else {
                $this->error('没有发生更改!');
            }
        }
        $config = $config_db->select();

        $this->assign('config', $config);
        $this->display();
    }
}